package com.zzz.cloud.thrift;

import com.zzz.cloud.thrift.provider.EurekaServerMetaDataProvider;
import com.zzz.cloud.thrift.provider.ServerInfoProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@AutoConfigureAfter(ThriftServerAutoConfiguration.class)
@ConditionalOnProperty(name = "spring.thrift.server.eureka.discovery.enabled", havingValue = "true")
@Import(ThriftServerAutoConfiguration.class)
public class ThriftServerEurekaDiscoveryConfiguration {

    @Bean
    public EurekaServerMetaDataProvider serverMetaDataProvider(ServerInfoProvider serverInfoProvider) {
        return new EurekaServerMetaDataProvider(serverInfoProvider);
    }

}
